<template>
	<view class="HouseItemComp" @click="toHouseDetail">
		<image class="img_1" :src="itemData.picture_url" mode="aspectFill"></image>
		<view class="info-box">
			<view class="top">
				<view class="title-text text-ellipsis">{{itemData.name || '无'}}</view>
				<view class="location-text text-ellipsis">位置：{{itemData.local || '无'}} </view>
				<view class="area-text text-ellipsis">面积：{{itemData.area || 0}}㎡</view>
			</view>
			<view class="bottom-box">
				<view class="price">￥{{itemData.monthly_rent || 0}}/月</view>
				<view v-if="showBtn" class="btn">预约看房</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'HouseItem',
		props:{
			showBtn:{
				type:Boolean,
				default:true
			}
		},
		data() {
			return {
				itemData: {
					area: 1098,
					id: '1347d9ebb5534cbcb58068698a423571',
					local: 'A3三层311',
					monthly_rent: 34000,
					name: 'A3三层311',
					picture_url: 'https://manage.yuansaas.com/formAtt/42081569346583617d83739219c48b89_1630027481472.jpg'
				}
			}
		},
		methods: {
			toHouseDetail() {
				uni.navigateTo({
					url: '/pages/house/houseDetail/houseDetail'
				})
			}
		}
	}
</script>

<style scoped>
	.HouseItemComp {
		width: 100%;
		display: flex;

	}

	.HouseItemComp .img_1 {
		width: 220rpx;
		height: 220rpx;
		background-color: #F7F7F8;
		margin-right: 20rpx;
		border-radius: 10rpx;
	}

	.HouseItemComp .info-box {
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		/* align-items: center; */
	}

	.HouseItemComp .info-box .title-text {
		max-width: 390rpx;
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #333444;
		margin-bottom: 12rpx;
	}

	.HouseItemComp .info-box .location-text {
		max-width: 390rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #666777;
		margin-bottom: 12rpx;
	}

	.HouseItemComp .info-box .area-text {
		max-width: 390rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #666777;
		margin-bottom: 22rpx;
	}

	.HouseItemComp .info-box .bottom-box {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 390rpx;
		height: 64rpx;
		background-color: #FFF2F3;
		border-radius: 6rpx;
		padding-left: 12rpx;
	}

	.HouseItemComp .info-box .bottom-box .price {
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #FF455A;
	}

	.HouseItemComp .info-box .bottom-box .btn {
		width: 144rpx;
		height: 64rpx;
		background: linear-gradient(96deg, #FF455A 0%, #EB1364 100%);
		border-radius: 6rpx;
		text-align: center;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: bold;
		line-height: 64rpx;
		color: #FFFFFF;
	}
</style>
